﻿using MediatR;
using W.Carrier.Domain;
using W.Carrier.Read.Api.Application.Command;
using W.Carrier.Repostiory.Interface;

namespace W.Carrier.Read.Api.Application.CommandHandler
{
    public class CarrierModelCommandHandler:IRequestHandler<CarrierModelCommand, CarrierInfo>
    {
        private readonly ICarrierInfoRepository _icarrierInfoRepository;
        public CarrierModelCommandHandler(ICarrierInfoRepository icarrierInfoRepository)
        {
            _icarrierInfoRepository = icarrierInfoRepository;
        }

        public async Task<CarrierInfo> Handle(CarrierModelCommand request, CancellationToken cancellationToken)
        {
            var list = await _icarrierInfoRepository.GetModelAsync(request.CarrierId);
            return list;
        }
    }
}
